<!DOCTYPE html>
<html>
<head>
    <title>按钮点击发送请求</title>
</head>
<body>
<button onclick="sendRequest()">扫二维码 码确认登陆</button>

<!--<button onclick="window.location.href='http://10.211.55.8:8080/oauth2/wechat/callback?code=code123&state=AdDGbQnyQDWWEyf739cZZz'">扫二维码 码确认登陆</button>-->

<script>
    function sendRequest() {
        var xhr = new XMLHttpRequest();
        xhr.open("GET", "/confirm_login", true);
        xhr.onreadystatechange = function() {
            if (xhr.readyState === 4 && xhr.status === 200) {
                console.log(xhr.responseText);
                window.location.href = xhr.responseText;
            }
        };

        xhr.send();
    }
</script>
</body>
</html>
